package com.study.gamecube.service;

import com.study.gamecube.dao.GameOrderDao;
import com.study.gamecube.pojo.GameOrder;
import com.study.gamecube.pojo.OrderState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GameOrderService {
    @Autowired
    private GameOrderDao gameOrderDao;

    public GameOrder createOrder(GameOrder order) {
        order.setState(OrderState.INIT);
        return gameOrderDao.save(order);
    }

    public GameOrder getById(Long id) {
        return gameOrderDao.getById(id);
    }

    public List<GameOrder> findAll(){
        return gameOrderDao.findAll();
    }
}
